﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.CodeDom;
using CodeDomHelper.Types;

namespace CodeDomHelper.CodeDom
{

    [Serializable()]
    [System.Diagnostics.DebuggerStepThrough()]
    public class CastExp : CodeCastExpression
    {

        public CastExp(): base() {}
      
        public CastExp(CodeTypeReference targetType, CodeExpression expression)
            : base(targetType, expression) { }

        public CastExp(string targetType, CodeExpression expression) 
            : base(targetType, expression) { }

        public CastExp(Type targetType, CodeExpression expression) 
            : base(targetType, expression) { }

        public CastExp(TypeExp targetType, CodeExpression expression)
            : base(targetType, expression) { }



        #region Property

        public PropertyExp Property(string propertyName, string typeName)
        {
            return new PropertyExp(this, propertyName, typeName);
        }

        public PropertyExp PropertyExp(string propertyName, TypeExp type)
        {
            return new PropertyExp(this, propertyName, type);
        }

        public PropertyExp Property(string propertyName, Type type)
        {
            return new PropertyExp(this, propertyName, type);
        }

        public PropertyExp Property(string propertyName, TypeExpression type)
        {
            return new PropertyExp(this, propertyName, type);
        }

        #endregion

        #region Field

        public FieldExp Field(string fieldName, string typeName)
        {
            return new FieldExp(this, fieldName, typeName);
        }

        public FieldExp Field(string fieldName, TypeExp type)
        {
            return new FieldExp(this, fieldName, type);
        }

        public FieldExp Field(string fieldName, Type type)
        {
            return new FieldExp(this, fieldName, type);
        }

        public FieldExp Field(string fieldName, TypeExpression type)
        {
            return new FieldExp(this, fieldName, type);
        }

        #endregion

        #region Method

        public MethodExp Method(string methodName, TypeExp typeReturn)
        {
            return new MethodExp(this, methodName, typeReturn);
        }

        #endregion

        public CastExp As(TypeExp type)
        {
            return Helper.Cast(this, type);
        }

    }
}
